Telegram Group & Telegram Channel
✏️ Промпт дня: Следуй стандартам кода в C++

Если необходимо быстро привести код к определённому стилю, то этом случае можно воспользоваться следующим промптом.


🍴 Промпт для AI-помощника:

Rewrite the code below following the Google style guidelines for C++.

[Вставь свой код]



‼️ Пример использования промпта:

Было:

class userManager{
public:
int getUserCount(){return userCount;}
void setUserCount(int count){userCount=count;}
private:
int userCount;
};

void ProcessUserData(){
const int maxUsers=100;
userManager um;
for(int i=0;i<maxUsers;i++){
um.setUserCount(i);
}
}


Стало (после применения Google C++ Style Guide):

class UserManager {
public:
int GetUserCount() const { return user_count_; }
void SetUserCount(int count) { user_count_ = count; }

private:
int user_count_;
};

void ProcessUserData() {
const int MAX_USERS = 100;
UserManager user_manager;

for (int i = 0; i < MAX_USERS; ++i) {
user_manager.SetUserCount(i);
}
}


Что изменилось:

Функции в CamelCase
Переменные в snake_case
Константы в UPPER_CASE
Правильные отступы и пробелы


⛄️ А каким стилем для кода вы пользуетесь? Пишите в комментариях.

Библиотека C/C++ разработчика #буст
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/cppproglib/5784
Create:
Last Update:

✏️ Промпт дня: Следуй стандартам кода в C++

Если необходимо быстро привести код к определённому стилю, то этом случае можно воспользоваться следующим промптом.


🍴 Промпт для AI-помощника:

Rewrite the code below following the Google style guidelines for C++.

[Вставь свой код]



‼️ Пример использования промпта:

Было:

class userManager{
public:
int getUserCount(){return userCount;}
void setUserCount(int count){userCount=count;}
private:
int userCount;
};

void ProcessUserData(){
const int maxUsers=100;
userManager um;
for(int i=0;i<maxUsers;i++){
um.setUserCount(i);
}
}


Стало (после применения Google C++ Style Guide):

class UserManager {
public:
int GetUserCount() const { return user_count_; }
void SetUserCount(int count) { user_count_ = count; }

private:
int user_count_;
};

void ProcessUserData() {
const int MAX_USERS = 100;
UserManager user_manager;

for (int i = 0; i < MAX_USERS; ++i) {
user_manager.SetUserCount(i);
}
}


Что изменилось:

Функции в CamelCase
Переменные в snake_case
Константы в UPPER_CASE
Правильные отступы и пробелы


⛄️ А каким стилем для кода вы пользуетесь? Пишите в комментариях.

Библиотека C/C++ разработчика #буст

BY Библиотека C/C++ разработчика | cpp, boost, qt


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/cppproglib/5784

View MORE
Open in Telegram


Библиотека C C разработчика | cpp boost qt Telegram | DID YOU KNOW?

Date: |

Newly uncovered hack campaign in Telegram

The campaign, which security firm Check Point has named Rampant Kitten, comprises two main components, one for Windows and the other for Android. Rampant Kitten’s objective is to steal Telegram messages, passwords, and two-factor authentication codes sent by SMS and then also take screenshots and record sounds within earshot of an infected phone, the researchers said in a post published on Friday.

The seemingly negative pandemic effects and resource/product shortages are encouraging and allowing organizations to innovate and change.The news of cash-rich organizations getting ready for the post-Covid growth economy is a sign of more than capital spending plans. Cash provides a cushion for risk-taking and a tool for growth.

Библиотека C C разработчика | cpp boost qt from ua


Telegram Библиотека C/C++ разработчика | cpp, boost, qt
FROM USA